/*
 *  Copyright 2001-2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package ar.uba.fi.posgrado.economy.service;

import ar.uba.fi.posgrado.common.dao.NoSuchEntityException;
import ar.uba.fi.posgrado.common.exception.MissingArgumentException;
import ar.uba.fi.posgrado.common.exception.PosgradoException;
import ar.uba.fi.posgrado.common.exception.PosgradoRuntimeException;
import ar.uba.fi.posgrado.common.exception.RepeatedInstanceException;
import ar.uba.fi.posgrado.common.exception.RepeatedNameException;
import ar.uba.fi.posgrado.common.service.GenericService;
import ar.uba.fi.posgrado.economy.model.Customer;
import ar.uba.fi.posgrado.economy.model.CustomerAccount;

public interface CustomerAccountService extends GenericService<CustomerAccount> {

	/**
	 * Crea una cuenta corriente nueva
	 * 
	 * @param account
	 *            cuenta corriente a crear
	 * @throws PosgradoRuntimeException
	 * @throws RepeatedInstanceException
	 * @throws PosgradoException
	 */
	public abstract void create(CustomerAccount account)
			throws PosgradoRuntimeException, PosgradoException,
			RepeatedInstanceException, MissingArgumentException;

	/**
	 * Modifica los datos de la cuenta que se pasa por parametro, si existe. En
	 * caso contrario, lanza una excepcion
	 * 
	 * @param account
	 *            cuenta corriente a actualizar
	 * @throws PosgradoRuntimeException
	 * @throws RepeatedInstanceException
	 * @throws PosgradoException
	 */
	public abstract CustomerAccount update(CustomerAccount account)
			throws PosgradoRuntimeException, PosgradoException,
			NoSuchEntityException, RepeatedNameException;

	/**
	 * Busca por cliente.<br>
	 * Hace una busqueda por cliente.<br>
	 * 
	 * @param customerId
	 *            id del cliente
	 * @return
	 * @throws PosgradoRuntimeException
	 * @throws PosgradoException
	 */
	public abstract CustomerAccount getByCustomerId(Long customerId)
			throws PosgradoRuntimeException, PosgradoException;

	/**
	 * Busca el cliente de la cuenta
	 * 
	 * @param accountId
	 *            id de la cuenta
	 * @return customer el cliente
	 * @throws PosgradoRuntimeException
	 * @throws PosgradoException
	 */
	public abstract Customer getCustomerByAccountId(Long accountId)
			throws PosgradoRuntimeException, PosgradoException;
	
}
